﻿<!--
<copyright company="Christoph van der Fecht - VDsoft">
Copyright (C) Christoph van der Fecht - VDsoft - All Rights Reserved
Unauthorized copying of this file, via any medium is strictly prohibited,
unless it is communicated and authorized by the copyright owner.
</copyright>
-->
<Window x:Class="SeriesManager.SearchSeries"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		Title="Search series" 
		Height="500" 
		Width="400"
		MinHeight="500"
		MinWidth="400"
		WindowStartupLocation="CenterScreen"
		DataContext="{Binding Path=SearchSeriesView, Source={StaticResource ResourceKey=Locator}}">
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="4*"/>
			<RowDefinition Height="2*"/>
			<RowDefinition Height="2*"/>
			<RowDefinition Height="12*"/>
			<RowDefinition Height="1*"/>
		</Grid.RowDefinitions>
		<!--Mirror-->
		<StackPanel Orientation="Horizontal" Grid.Row="0">
			<ListView ItemsSource="{Binding Path=Mirrors, Mode=OneWay}"
					  SelectedValue="{Binding Path=SelectedMirror, Mode=TwoWay}"
					  SelectedIndex="0"
					  Margin="5"
					  MinWidth="150"
					  MinHeight="70">
				<ListView.ItemTemplate>
					<DataTemplate>
						<TextBlock Text="{Binding Path=Address, Mode=OneWay}"
								   Margin="3"/>
					</DataTemplate>
				</ListView.ItemTemplate>
			</ListView>
			<Button Content="Get Mirrors"
					Command="{Binding Path=GetMirrorsCommand}"
					Margin="5"
					VerticalAlignment="Center"/>
		</StackPanel>
		<!--Select language-->
		<StackPanel Orientation="Horizontal"
					Grid.Row="1"
					HorizontalAlignment="Left">
			<TextBlock Text="Available languages:"
					   Margin="5,10,5,5"
					   VerticalAlignment="Center"/>
			<ComboBox ItemsSource="{Binding Path=AvailableLanguages, Mode=OneWay}"
					  SelectedValue="{Binding Path=SelectedLanguage, Mode=TwoWay}"
					  VerticalAlignment="Center"
					  SelectedIndex="0"
					  DisplayMemberPath="Name"
					  MinWidth="120"
					  Margin="5"/>
		</StackPanel>
		<!--Search criterion-->
		<StackPanel Orientation="Horizontal"
					Grid.Row="2">
			<TextBlock Text="Series name:"
					   VerticalAlignment="Center"
					   Margin="2,5,2,5"/>
			<TextBox x:Name="textBoxSearchCriterion"
					 Text="{Binding Path=SearchCriterion, Mode=TwoWay}"
					 VerticalAlignment="Center"
					 Width="200"
					 Margin="5"
					 KeyDown="OnKeyDown"/>
			<Button Content="Search"
					VerticalAlignment="Center"
					Margin="5"
					Width="60"
					Command="{Binding Path=SearchSeriesCommand}"/>
		</StackPanel>
		<!--Search result-->
		<Grid Grid.Row="3">
			<Grid.RowDefinitions>
				<RowDefinition Height="6*"/>
				<RowDefinition Height="3*"/>
			</Grid.RowDefinitions>
			<ListBox ItemsSource="{Binding Path=FoundSeries, Mode=OneWay}"
					 SelectedValue="{Binding Path=SelectedSeries, Mode=TwoWay}"
					 Grid.Row="0"
					 ScrollViewer.CanContentScroll="True"
					 SelectedIndex="0"
					 Margin="5,5,5,14"
					 MinHeight="120">
				<ListBox.ItemTemplate>
					<DataTemplate>
							<TextBlock Text="{Binding Path=Name, Mode=OneWay}"
									   Margin="5"/>
					</DataTemplate>
				</ListBox.ItemTemplate>
			</ListBox>
			<Image Source="{Binding Path=BannerAddress, Mode=OneWay}"
				   Grid.Row="1"
				   Margin="2"
				   VerticalAlignment="Center"
				   Stretch="Uniform"/>
		</Grid>
		<Button Content="OK"
				Margin="120,1,120,1"
				VerticalAlignment="Center"
				HorizontalAlignment="Stretch"
				Grid.Row="4"
				Command="{Binding Path=SubmitSeriesCommand}"/>
	</Grid>
</Window>
